package book.data_clean;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Data implements WritableComparable<Data> {
    private String positionName;
    private String Salary;
    private Integer minSalary;
    private Integer maxSalary;
    private String workYear;
    private String city;
    private String companyShortName;
    private String companySize;
    private String district;
    private String financeStage;
    private String industryField;
    private String thirdType;
    private Integer resumeProcessDay;
    private Integer resumeProcessRate;
    private String education;

    public void set(String positionName, String Salary,Integer minSalary, Integer maxSalary, String workYear, String city, String companyShortName, String companySize, String district, String financeStage, String industryField, String thirdType, Integer resumeProcessDay, Integer resumeProcessRate, String education) {
        this.positionName = positionName;
        this.Salary = Salary;
        this.minSalary = minSalary;
        this.maxSalary = maxSalary;
        this.workYear = workYear;
        this.city = city;
        this.companyShortName = companyShortName;
        this.companySize = companySize;
        this.district = district;
        this.financeStage = financeStage;
        this.industryField = industryField;
        this.thirdType = thirdType;
        this.resumeProcessDay = resumeProcessDay;
        this.resumeProcessRate = resumeProcessRate;
        this.education = education;
    }

    @Override
    public String toString() {
        return positionName +
                "," + Salary +
                "," + minSalary +
                "," + maxSalary +
                "," + workYear +
                "," + city +
                "," + companyShortName +
                "," + companySize +
                "," + district +
                "," + financeStage +
                "," + industryField +
                "," + thirdType +
                "," + resumeProcessDay +
                "," + resumeProcessRate +
                "," + education;
    }

    public String getEducation() {
        return education;
    }

    public String getSalary() {
        return Salary;
    }

    public void setSalary(String salary) {
        Salary = salary;
    }

    public void setEducation(String education) {
        this.education = education;
    }

    public String getPositionName() {
        return positionName;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    public Integer getMinSalary() {
        return minSalary;
    }

    public void setMinSalary(Integer minSalary) {
        this.minSalary = minSalary;
    }

    public Integer getMaxSalary() {
        return maxSalary;
    }

    public void setMaxSalary(Integer maxSalary) {
        this.maxSalary = maxSalary;
    }

    public String getWorkYear() {
        return workYear;
    }

    public void setWorkYear(String workYear) {
        this.workYear = workYear;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCompanyShortName() {
        return companyShortName;
    }

    public void setCompanyShortName(String companyShortName) {
        this.companyShortName = companyShortName;
    }

    public String getCompanySize() {
        return companySize;
    }

    public void setCompanySize(String companySize) {
        this.companySize = companySize;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getFinanceStage() {
        return financeStage;
    }

    public void setFinanceStage(String financeStage) {
        this.financeStage = financeStage;
    }

    public String getIndustryField() {
        return industryField;
    }

    public void setIndustryField(String industryField) {
        this.industryField = industryField;
    }

    public String getThirdType() {
        return thirdType;
    }

    public void setThirdType(String thirdType) {
        this.thirdType = thirdType;
    }

    public Integer getResumeProcessDay() {
        return resumeProcessDay;
    }

    public void setResumeProcessDay(Integer resumeProcessDay) {
        this.resumeProcessDay = resumeProcessDay;
    }

    public Integer getResumeProcessRate() {
        return resumeProcessRate;
    }

    public void setResumeProcessRate(Integer resumeProcessRate) {
        this.resumeProcessRate = resumeProcessRate;
    }

    @Override
    public int compareTo(Data o) {
        return 0;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeUTF(positionName);
        dataOutput.writeUTF(Salary);
        dataOutput.writeInt(minSalary);
        dataOutput.writeInt(maxSalary);
        dataOutput.writeUTF(workYear);
        dataOutput.writeUTF(city);
        dataOutput.writeUTF(companyShortName);
        dataOutput.writeUTF(companySize);
        dataOutput.writeUTF(district);
        dataOutput.writeUTF(financeStage);
        dataOutput.writeUTF(industryField);
        dataOutput.writeUTF(thirdType);
        dataOutput.writeInt(resumeProcessDay);
        dataOutput.writeInt(resumeProcessRate);
        dataOutput.writeUTF(education);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        positionName = dataInput.readUTF();
        Salary = dataInput.readUTF();
        minSalary = dataInput.readInt();
        maxSalary = dataInput.readInt();
        workYear = dataInput.readUTF();
        city = dataInput.readUTF();
        companyShortName = dataInput.readUTF();
        companySize = dataInput.readUTF();
        district = dataInput.readUTF();
        financeStage = dataInput.readUTF();
        industryField = dataInput.readUTF();
        thirdType = dataInput.readUTF();
        resumeProcessDay = dataInput.readInt();
        resumeProcessRate = dataInput.readInt();
        education = dataInput.readUTF();
    }
}
